home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / mmailp.idb / usr / lib / Zmail / samples / zscript / reply+.zsc.z / reply+.zsc
Encoding:
Text File  |  1997-01-22  |  1.4 KB  |  53 lines

  1. # Sample Z-Script function: reply
  2.  
  3. # One of the oddities of the builtin "reply" command is that it takes
  4. # more than one message list -- first the list being replied-to, then
  5. # a list of inclusions.  It's easy to forget that the current message
  6. # is 5 and type "reply -ei 12" expecting to reply to the author of
  7. # message 12, and instead get the author of message 5.  What you
  8. # *wanted* to type was "reply 12 -ei".
  9. #
  10. # Front-end to the "reply" command to assure that the current message is in
  11. # the list of included messages, or that you really *meant* to leave it out.
  12. #
  13. # Bug: Quoted items in $* are not handled, so the -s option isn't useful.
  14. # It isn't generally used with "reply" ...
  15. #
  16. function reply() {
  17.     if $?1
  18.     set arg = "$1"
  19.     shift
  20.         if "$arg" =~ -*i*
  21.         #
  22.         # The  -i option was given.  Use the message list difference
  23.         # operation to test for inclusion of the current message.
  24.         #
  25.         set _list = .
  26.         unset _rest
  27.         msg_list $* | set _list
  28.         msg_list $_list {.} | set _rest
  29.         if $?_rest
  30.         if "$_list" == "$_rest"
  31.             ask "Current message not in include list -- OK?"
  32.             if $status != 0
  33.             return -1
  34.             endif
  35.         endif
  36.         unset _rest
  37.         endif
  38.         unset _list
  39.         endif
  40.     if $?input
  41.         $input | builtin reply $arg $*
  42.     else
  43.         builtin reply $arg $*
  44.     endif
  45.     else
  46.     if $?input
  47.         $input | builtin reply $*
  48.     else
  49.         builtin reply $*
  50.     endif
  51.     endif
  52. }
  53.